<?php
/**
 * 系統名稱: Lotto 系統
 * 檔案說明: 專案管理-修改
 * $Author$
 * $Id$
 *
 */
$_data["NumberSpecial"] = intval(trim($_data["NumberSpecial"]));
$_data["NumberNormal0"] = intval(trim($_data["NumberNormal0"]));
$_data["NumberNormal1"] = intval(trim($_data["NumberNormal1"]));
$_data["NumberNormal2"] = intval(trim($_data["NumberNormal2"]));
$_data["NumberNormal3"] = intval(trim($_data["NumberNormal3"]));
$_data["NumberNormal4"] = intval(trim($_data["NumberNormal4"]));
$_data["NumberNormal5"] = intval(trim($_data["NumberNormal5"]));
$_data["NumberNormal6"] = intval(trim($_data["NumberNormal6"]));
$intID = (int)$_data["ID"];
$intLID = (int)$_data["LottoID"];
$intLType = $_arrLotto[$intLID]["LType"];
$arrColorSet = explode(",", $_arrLotto[$intLID]["ColorSet"]);
$arrBColor = array("FF0000","0000FF", "00FF00");

$arrData = array();
$arrColor = array();
for($i = 0; $i < 7; $i++){
	$arrData[] = $_data["NumberNormal".$i];
	$arrColor[] = "<a style='font-weight:700; color: #".$arrBColor[$arrColorSet[((int)$_data["NumberNormal".$i] - 1)]]."'>".$_data["NumberNormal".$i]."</a>";
}
$_data["NumberNormal"] = implode(",", $arrData);

$strSQL = "select ID from `bet_Gamble` where isEnd = 0 and ID = ".$intID;
if(!$RS = PMA_mysql_query($strSQL, $$_Conn)){
	$GLOBALS["errormessage"] = "Find Game Data Error!!";
	$GLOBALS["errorhidden"] = "\nError: ".PMA_mysql_error($$_Conn).",\nLine: ".__LINE__.",\nPage: ".__FILE__;
	ErrMsgOutputHTML("Error1", "", 1);
}

if(PMA_mysql_num_rows($RS) == 0){
	if(!makeShowScoreFile($intLID, "", "", "")){
		ErrMsgOutputHTML("Error2", "", 1);
	}
}else{
	if(!makeShowScoreFile($intLID, $_data["NumberNormal"], $_data["NumberSpecial"], "")){
		ErrMsgOutputHTML("Error3", "", 1);
	}
}

$strErrTitle = $_strCompetition["ShowScore_Title"];
$_data["NumberNormal"] = implode(", ", $arrColor)."<br />";
if($_data["NumberSpecial"] != "")$_data["NumberSpecial"] = "<a style='font-weight:700; color: #".$arrBColor[$arrColorSet[((int)$_data["NumberSpecial"] - 1)]]."'>".sprintf("%d", $_data["NumberSpecial"])."</a>";
$GLOBALS["errormessage"] = $_strCompetition["ShowScore".$intLType."_Tip"];
$GLOBALS["errormessage"] = str_replace("{NumberNormal}", $_data["NumberNormal"], $GLOBALS["errormessage"]);
$GLOBALS["errormessage"] = str_replace("{NumberSpecial}", $_data["NumberSpecial"], $GLOBALS["errormessage"]);
$isNotAlert = true;
ErrMsgOutputHTML("Error4", "", 1);
?>